﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace LongNet.Config
{
    /// <summary>
    /// Represents a method that's invoked each time the config entity changes.
    /// </summary>
    /// <param name="sender"></param>
    /// <param name="e"></param>
    public delegate void AppConfigChangedEventHandler(object sender, AppConfigChangedEventArgs e);

    /// <summary>
    /// Represents a method that's invoked each time the config entity fails to get reloaded.
    /// </summary>
    /// <param name="sender"></param>
    /// <param name="e"></param>
    public delegate void AppConfigReloadFailedEventHandler(object sender, AppConfigReloadFailedEventArgs e);


    /// <summary>
    /// 
    /// </summary>
    public class AppConfigChangedEventArgs : EventArgs
    {
        /// <summary>
        /// 
        /// </summary>
        public FileConfigEntity Config { get; set; }

        /// <summary>
        /// 
        /// </summary>
        public AppConfigChangedEventArgs()
            : this(null) { }

        /// <summary>
        /// 
        /// </summary>
        /// <param name="config"></param>
        public AppConfigChangedEventArgs(FileConfigEntity config)
        {
            Config = config;
        }
    }

    /// <summary>
    /// 
    /// </summary>
    public class AppConfigReloadFailedEventArgs : EventArgs
    {
        /// <summary>
        /// The exception catched if fail to reload.
        /// </summary>
        public Exception Exception { get; set; }

        /// <summary>
        /// 
        /// </summary>
        public AppConfigReloadFailedEventArgs()
            : this(null) { }

        /// <summary>
        /// 
        /// </summary>
        /// <param name="exception"></param>
        public AppConfigReloadFailedEventArgs(Exception exception)
        {
            Exception = exception;
        }
    }
}
